@import '_variables';

.dropdown-wrapper {
  cursor: pointer;

  .dropdown-title {
    display: inline-block;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: inherit;
    padding: inherit;
    line-height: 1.4rem;
    background: transparent;
    border: none;
    //font-weight: 500;
    color: var(--c-text);

    &:hover {
      border-color: transparent;
    }

    .arrow {
      vertical-align: middle;
      margin-top: -1px;
      margin-left: 0.4rem;
    }
  }

  .mobile-dropdown-title {
    @extend .dropdown-title;
    display: none;
    font-weight: 600;
    font-size: inherit;
    &:hover {
      color: var(--c-text-accent);
    }
  }

  .nav-dropdown {
    .dropdown-item {
      color: inherit;
      line-height: 1.7rem;

      .dropdown-subtitle {
        margin: 0.45rem 0 0;
        border-top: 1px solid var(--c-border);
        padding: 1rem 0 0.45rem 0;
        font-size: 0.9rem;

        & > span {
          padding: 0 1.5rem 0 1.25rem;
        }

        & > a {
          font-weight: inherit;
          &.router-link-active {
            &::after {
              display: none;
            }
          }
        }
      }

      .dropdown-subitem-wrapper {
        padding: 0;
        list-style: none;

        .dropdown-subitem {
          font-size: 0.9em;
        }
      }

      a {
        display: block;
        line-height: 1.7rem;
        position: relative;
        border-bottom: none;
        font-weight: 400;
        margin-bottom: 0;
        padding: 0 1.5rem 0 1.25rem;

        &:hover {
          color: #8186d5;
        }

        &.router-link-active {
          color: #8186d5;
          font-weight: 550;

          /*&::before {
            content: '\e905';
            width: 0;
            height: 0;
            !*border-left: 5px solid var(--c-text-accent);
            border-top: 3px solid transparent;
            border-bottom: 3px solid transparent;
            position: absolute;
            top: calc(50% - 2px);
            left: 9px;*!
            font-family: aurora-icomoon;
          }*/
        }
      }

      &:first-child .dropdown-subtitle {
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
      }
    }
  }
}

@media (max-width: $MQMobile) {
  .dropdown-wrapper {
    &.open .dropdown-title {
      margin-bottom: 0.5rem;
    }

    .dropdown-title {
      display: none;
    }

    .mobile-dropdown-title {
      display: block;
    }

    .nav-dropdown {
      transition: height 0.1s ease-out;
      overflow: hidden;

      .dropdown-item {
        .dropdown-subtitle {
          border-top: 0;
          margin-top: 0;
          padding-top: 0;
          padding-bottom: 0;
        }

        .dropdown-subtitle,
        & > a {
          font-size: 15px;
          line-height: 2rem;
        }

        .dropdown-subitem {
          font-size: 14px;
          padding-left: 1rem;
        }
      }
    }

    //  设置滚动条样式
    .nav-dropdown::-webkit-scrollbar {
      width: 0px;
      height: 0px;

    }
  }
}

@media (min-width: ($MQMobile + 1)) {
  .dropdown-wrapper {
    height: 1.8rem;

    &:hover .nav-dropdown,
    &.open .nav-dropdown {
      // override the inline style.
      display: block !important;
    }

    &.open:blur {
      display: none;
    }

    .nav-dropdown {
      display: none;
      // Avoid height shaked by clicking
      height: auto !important;
      box-sizing: border-box;
      max-height: calc(100vh - 2.7rem);
      overflow-y: auto;
      position: absolute;
      top: 100%;
      right: 0;
      background-color: var(--c-bg-navbar);
      padding: 0.6rem 0;
      border: 1px solid var(--c-border);
      border-bottom-color: var(--c-border-dark);
      text-align: left;
      border-radius: 0.25rem;
      white-space: nowrap;
      margin: 0;
    }
    //  设置滚动条样式
    .nav-dropdown::-webkit-scrollbar {
      width: 2px;
      height: 2px;

    }
  }
}

/**
 * transition
 */
.dropdown-enter-from,
.dropdown-leave-to {
  height: 0 !important;
}
